class Solution {
public:
    int combinationSum4(vector<int>& nums, int target) {
        vector<unsigned long long> a(target + 1);
        a[0] = 1;
        for (int i = 1; i <= target; i++) {
            for (int j=0;j<nums.size();j++) {
                if (nums[j] <= i) {
                    a[i] += a[i -nums[j]];
                }
            }
        }
        return a[target];
    }
};


